package cn.tedu._07springaop.aop;

import org.springframework.stereotype.Component;

@Component
public class CalculatorIml implements Calculator {

    @Override
    public int add(int x, int y) {
        if (x<10){
            throw new IllegalArgumentException("x不能大于0");
        }
        int result =x+y;
        System.out.println("计算结果："+result);
        return result;
    }

    @Override
    public int sub(int x, int y) {
        int result =x-y;
        System.out.println("计算结果："+result);
        return 0;
    }

    @Override
    public int mul(int x, int y) {
        int result =x*y;
        System.out.println("计算结果："+result);
        return 0;
    }

    @Override
    public int div(int x, int y) {
        int result =x/y;
        System.out.println("计算结果："+result);
        return 0;
    }
}
